import { getReportCfg, getMetricsGroup } from '@/api/feedback/report'
const dataBase = {

}

export function getOverview (key = 'data_overview', opt = {}) {
  return new Promise(async (resolve, reject) => {
    if (dataBase[key]) {
      resolve(dataBase[key])
      return
    }
    const bigID = await getReportCfg({
      page: key
    }).then(res => res.data.id)
    const metricsGroup = await getMetricsGroup(bigID).then(res => res.data[0])
    dataBase[key] = metricsGroup
    resolve(dataBase[key])
  })
}
